package io.esirong.camera;


import android.os.Build;
import android.util.Log;

public class CameraFactory {
    public static CameraWrapper getCamera() {
        CameraWrapper cameraWrapper;
        cameraWrapper = new CameraWrapperImpl();
        // From Lollipop, android implements new Camera architecture.
        // So import Camera2.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Log.d("CameraFactory", "use Camera2");
            cameraWrapper = new Camera2WrapperImpl();
        } else {
            Log.d("CameraFactory", "use Camera");
            cameraWrapper = new CameraWrapperImpl();
        }
        return cameraWrapper;
    }


}
